import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class HomeNav extends StatefulWidget {
  const HomeNav({Key? key}) : super(key: key);

  @override
  _HomeNavState createState() => _HomeNavState();
}

class _HomeNavState extends State<HomeNav> {
  List _navList = [
    {
      'label': '我的房屋',
      'icon': 'assets/images/house_nav_icon@2x.png',
    },
    //我的报修
    {
      'label': '我的报修',
      'icon': 'assets/images/repair_nav_icon@2x.png',
    },
    //访客登记
    {
      'label': '访客登记',
      'icon': 'assets/images/visitor_nav_icon@2x.png',
    },
  ];
  List<Widget> getNavListwidget() {
    return _navList.map((item) {
      return Expanded(
          child: Column(
        children: [
          Image.asset(
            item["icon"],
            height: 30,
            width: 30,
          ),
          Text(item["label"])
        ],
      ));
    }).toList();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(top: 10, bottom: 10),
      padding: EdgeInsets.only(left: 10, bottom: 10),
      child: Row(
        children: getNavListwidget(),
      ),
    );
  }
}
